<template>
  <div class="statistics-container">
    <back-header title="数据统计">
      <template #icon>
        <van-icon name="chart-trending-o" size="24" />
      </template>
      <template #right>
        <van-icon name="filter-o" size="20" />
      </template>
    </back-header>

    <div style="height: 56px"></div>

    <van-tabs
      v-model:active="active"
      sticky
      animated
      swipeable
      color="#3498db"
      title-active-color="#3498db"
      title-inactive-color="#666"
      line-height="3px"
    >
      <van-tab title="答题统计">
        <div class="tab-content">
          <question-num />
        </div>
      </van-tab>
      <van-tab title="学习记录">
        <div class="tab-content">
          <user-record />
        </div>
      </van-tab>
      <van-tab title="错题收藏">
        <div class="tab-content">
          <wrong-and-collect />
        </div>
      </van-tab>
      <van-tab title="成绩分析">
        <div class="tab-content">
          <score />
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script setup>
import { ref } from "vue";
import BackHeader from "@/components/common/BackHeader.vue";
import questionNum from "@/views/learning/statistics/questionNum.vue";
import userRecord from "@/views/learning/statistics/userRecord.vue";
import wrongAndCollect from "@/views/learning/statistics/wrongAndCollect.vue";
import score from "@/views/learning/statistics/score.vue";

const active = ref(0);
</script>

<style scoped>
.statistics-container {
  min-height: 100vh;
  background-color: #f5f7fa;
  display: flex;
  flex-direction: column;
}

.tab-content {
  padding: 16px;
  background-color: #f5f7fa;
  min-height: calc(100vh - 120px);
}

:deep(.van-tabs__wrap) {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

:deep(.van-tabs__nav) {
  background-color: #fff;
}

:deep(.van-tab) {
  padding: 12px 0;
  font-size: 15px;
}

:deep(.van-tab--active) {
  font-weight: 600;
}

/* 适配暗色模式 */
@media (prefers-color-scheme: dark) {
  .statistics-container {
    background-color: #1a1a1a;
  }

  .tab-content {
    background-color: #1a1a1a;
  }
}
</style>
